package com.xly.webclick.vm;

import android.os.Bundle;
import android.support.annotation.DrawableRes;

import com.xly.webclick.base.BaseViewModel;
import com.xly.webclick.event.PhoneCodeEvent;
import com.xly.webclick.model.CountryDataBean;
import com.xly.webclick.vi.PhoneCodeChosenFeature;

import org.greenrobot.eventbus.EventBus;


public class CountryItemViewModel extends BaseViewModel implements PhoneCodeChosenFeature {

    public String countryCode;

    public String countryName;

    public String phoneCode;

    public int iconId;

    public CountryItemViewModel(CountryDataBean.CountryInnerBean countryDataBean, int iconId) {
        super(null);
        this.countryCode = countryDataBean.getCountryCode();
        this.countryName = countryDataBean.getCountryName();
        this.phoneCode = countryDataBean.getPhoneCode();
        this.iconId = iconId;
    }


    @DrawableRes
    public int getDrawable() {
        return iconId;
    }

    public void setDrawable(@DrawableRes int drawable) {
        this.iconId = drawable;
    }

    @Override
    public void onDestroy() {

    }
    @Override
    protected void initData(Bundle savedInstanceState) {

    }

    @Override
    public void onResume() {

    }

    @Override
    public void onPause() {

    }

    @Override
    public void onSelectPhoneCode() {
        EventBus.getDefault().post(new PhoneCodeEvent(countryCode, countryName, phoneCode));

    }
}
